package com.mic.service;

import com.mic.pojo.*;
import org.apache.ibatis.annotations.Param;
import org.springframework.ui.ModelMap;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;

public interface UserService {
    int addArticle(Article article);
    int deleteArticle(Integer articleId);
    int updateArticle(Article article);

   // List<Article> queryAllArticleByUserId(Integer userId);

    List<Article> queryTopFourArticles();//四个热电博文（点赞最多）

    List<Article> queryFiveUserFavoriteArticlesByUserId(Integer userId);//五个收藏的博文

    List<Article> queryAllUserFavoriteArticlesByUserId(Integer userId);//所有收藏的博文

    List<Article> queryAllUserArticlesByUserId(Integer userId);//该用户的所有博文
    
    List<User> queryAllUserSubscriptionById(Integer userId);//该用户的所有订阅

    List<Article> queryAllArticlesByTime (Integer userId);//按时间展示所有的文章

    int updatePersonalInfo(User user);//用户修改个人信息

    List<User> searchAllRelativeUsersByKeyEqualsUsername (String key);//根据key查询到所有的Users(key和username相似)

    List<Article> searchAllRelativeArticlesByKeyEqualsTitleOrInShort (String key);//根据key查询到所有的文章(key和title or inShort相似)

    Article searchArticleByCertainArticleId(Integer certainArticleId);

    User searchUserByCertainUserId(Integer certainUserId);

    //like
    Article queryArticleByArticleId(@Param("articleId") Integer articleId);

    //comment
    int addComment(Comment comment);
    List<Comment> queryAllCommentsByArticleId(Integer articleId);
    int deleteComment(@Param("commentId") Integer commentId);


    //subscription
    int addSubscription(UserSubscription userSubscription);
    List<UserSubscription> queryAllUserSubscriptionByUserId(Integer userId);
    int cancelSubscription(UserSubscription userSubscription);

    //favorite
    int addFavorite(UserFavorite userFavorite);
    List<UserFavorite> queryAllUserFavoriteByUserId(Integer userId);
    int cancelFavorite(UserFavorite userFavorite);

    //最热博主
    Article hotUser();
    List<Article> decsSixArticlesByLikes(Integer userId);

    //发表文章
    int writeAnArticle(Article article);
    //获取inShort
    String getInShort(String text);
    //删除博文
    int deleteAnArticle(Integer articleId);

    //删除评论
    int deleteACommentId(Integer commentId);

    Comment getCommentById(Integer commentId);
}
